export function uploadFile ({ url, filePath, name, formData }) {
  // const { showErr } = extraConfig
  // const { loading = true } = extraConfig
  // loading && uni.showLoading({ mask: true })
  return new Promise((resolve, reject) => {
    uni.uploadFile({
      url: `${process.env.VUE_APP_BASE_URL}${url}`,
      filePath,
      name,
      // header: {
      //   Authorization: 'Bearer ' + getToken()
      // },
      formData,
      success: (response) => {
        // const res = JSON.parse(response.data)
      //   loading && uni.hideLoading()
      //   if (res.code !== 0 && showErr) {
      //  1
      //   }
        resolve(response.data)
      },
      fail: (res) => {
        reject(res)
      }
    })
  })
}
export function uploadImage(url) {
	return new Promise((resolve, reject) => {  
		uni.uploadFile({
			url: `${process.env.VUE_APP_BASE_URL}`+'/house/comm/uploadMaterial2', //后台地址
			filePath: url,
		  name: 'file',
      header:{
        Token:getToken()
      },
			success: (uploadFileRes) => {
        console.log('upload',uploadFileRes)
				resolve(uploadFileRes.data); 
			}
		})
	})
}